package ink.metoo.gude.module.websocket.service.impl

import ink.metoo.gude.properties.CloudflareProperties
import ink.metoo.gude.module.websocket.service.AiService
import org.springframework.ai.chat.messages.SystemMessage
import org.springframework.ai.chat.messages.UserMessage
import org.springframework.ai.chat.model.ChatModel
import org.springframework.stereotype.Service

@Service
class AiServiceImpl(
    private val chatModel: ChatModel,
    private val cloudflareProperties: CloudflareProperties,
) : AiService {

    override fun call(text: String): String = chatModel.call(
        SystemMessage(cloudflareProperties.ai.systemPrompt),
        UserMessage(text)
    )

}